<%@ page import="java.util.Hashtable" %>
<%@ page import="javax.naming.Context" %>
<%@ page import="javax.mail.Store" %>
<%@ page import="javax.mail.Folder" %>
<%@ page import="javax.mail.Session" %>
<%
Hashtable<String,String> props = new Hashtable<String,String>();
props.put(Context.INITIAL_CONTEXT_FACTORY,
            "org.jnp.interfaces.NamingContextFactory");
props.put(Context.URL_PKG_PREFIXES,
           "org.jboss.naming:org.jnp.interfaces");
props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
Context ctx = new javax.naming.InitialContext(props);
//
Object obj = ctx.lookup("java:/Mail");
System.out.println(obj.getClass());
System.out.println(obj instanceof Session);
try{
	Session mailSession = (Session)obj;
	Store store = mailSession.getStore();
	store.connect();
	Folder folder = store.getFolder("INPUT");
	folder.open(Folder.READ_ONLY);
	out.println(folder.getMessageCount());
}catch(Exception e){
	out.println(e);
}
out.println("<hr>");
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("java:MySqlDS");
java.sql.Connection con = ds.getConnection();
out.println(con);
con.close();
%>
<%= ctx.lookup("java:/Mail") %>
<%= ctx.lookup("java:MySqlDS") %>
<hr>

<%= ctx.lookup("topic/securedTopic").getClass() %><br>
<%= ctx.lookup("queue/testQueue").getClass() %><br>
<%= ctx.lookup("queue/DLQ").getClass() %><br>
<%= ctx.lookup("queue/A").getClass() %><br>
<%= ctx.lookup("queue/B").getClass() %><br>
<%= ctx.lookup("queue/C").getClass() %><br>
<%= ctx.lookup("java:JmsXA").getClass() %><br>
